package com.falm.picturebackend.entity.convert;

import com.falm.picturebackend.entity.BO.FileProcessingRecordsBO;
import com.falm.picturebackend.entity.DO.FileProcessingRecordsDO;
import com.falm.picturebackend.entity.VO.FileProcessingRecordsVO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Administrator
 */
public class FileProcessingRecordsConvert {

    public static FileProcessingRecordsBO do2BO(FileProcessingRecordsDO fileProcessingRecordsDO) {
        if (fileProcessingRecordsDO == null) {
            return null;
        }
        FileProcessingRecordsBO fileProcessingRecordsBO = new FileProcessingRecordsBO();
        fileProcessingRecordsBO.setId(fileProcessingRecordsDO.getId());
        fileProcessingRecordsBO.setFileUuid(fileProcessingRecordsDO.getFileUuid());
        fileProcessingRecordsBO.setProcessType(fileProcessingRecordsDO.getProcessType());
        fileProcessingRecordsBO.setProcessParameters(fileProcessingRecordsDO.getProcessParameters());
        fileProcessingRecordsBO.setProcessStatus(fileProcessingRecordsDO.getProcessStatus());
        fileProcessingRecordsBO.setInputFileUuid(fileProcessingRecordsDO.getInputFileUuid());
        fileProcessingRecordsBO.setOutputFileUuid(fileProcessingRecordsDO.getOutputFileUuid());
        fileProcessingRecordsBO.setCreateTime(fileProcessingRecordsDO.getCreateTime());
        fileProcessingRecordsBO.setUpdateTime(fileProcessingRecordsDO.getUpdateTime());
        return fileProcessingRecordsBO;
    }

    public static FileProcessingRecordsDO bo2DO(FileProcessingRecordsBO fileProcessingRecordsBO) {
        if (fileProcessingRecordsBO == null) {
            return null;
        }
        FileProcessingRecordsDO fileProcessingRecordsDO = new FileProcessingRecordsDO();
        fileProcessingRecordsDO.setId(fileProcessingRecordsBO.getId());
        fileProcessingRecordsDO.setFileUuid(fileProcessingRecordsBO.getFileUuid());
        fileProcessingRecordsDO.setProcessType(fileProcessingRecordsBO.getProcessType());
        fileProcessingRecordsDO.setProcessParameters(fileProcessingRecordsBO.getProcessParameters());
        fileProcessingRecordsDO.setProcessStatus(fileProcessingRecordsBO.getProcessStatus());
        fileProcessingRecordsDO.setInputFileUuid(fileProcessingRecordsBO.getInputFileUuid());
        fileProcessingRecordsDO.setOutputFileUuid(fileProcessingRecordsBO.getOutputFileUuid());
        fileProcessingRecordsDO.setCreateTime(fileProcessingRecordsBO.getCreateTime());
        fileProcessingRecordsDO.setUpdateTime(fileProcessingRecordsBO.getUpdateTime());
        return fileProcessingRecordsDO;
    }

    public static FileProcessingRecordsVO bo2VO(FileProcessingRecordsBO fileProcessingRecordsBO) {
        if (fileProcessingRecordsBO == null) {
            return null;
        }
        FileProcessingRecordsVO fileProcessingRecordsVO = new FileProcessingRecordsVO();
        fileProcessingRecordsVO.setId(fileProcessingRecordsBO.getId());
        fileProcessingRecordsVO.setFileUuid(fileProcessingRecordsBO.getFileUuid());
        fileProcessingRecordsVO.setProcessType(fileProcessingRecordsBO.getProcessType());
        fileProcessingRecordsVO.setProcessParameters(fileProcessingRecordsBO.getProcessParameters());
        fileProcessingRecordsVO.setProcessStatus(fileProcessingRecordsBO.getProcessStatus());
        fileProcessingRecordsVO.setInputFileUuid(fileProcessingRecordsBO.getInputFileUuid());
        fileProcessingRecordsVO.setOutputFileUuid(fileProcessingRecordsBO.getOutputFileUuid());
        fileProcessingRecordsVO.setCreateTime(fileProcessingRecordsBO.getCreateTime());
        fileProcessingRecordsVO.setUpdateTime(fileProcessingRecordsBO.getUpdateTime());
        return fileProcessingRecordsVO;
    }

    public static List<FileProcessingRecordsBO> do2BOList(List<FileProcessingRecordsDO> fileProcessingRecordsDOList) {
        return fileProcessingRecordsDOList.stream().map(FileProcessingRecordsConvert::do2BO).collect(Collectors.toList());
    }
}